window.Search = function(ymap,div){
	//this.gSearch = gSearch;
	this.ymap = ymap;
	this.uiDiv = div;
	this.init();
}

window.Search.prototype = {
	init:function(){
		this.initUI();
		this.localSearch = new LocalSearch(this.ymap.pointOperator);
		this.gSearch = new GSearch(this.ymap.map);
	},
	
	initUI:function(){
		var me = this;
		var root = $("#"+this.uiDiv);
		var keyword = this.inputKeyword = $("<input id='searchKeyword' type='text'></input>");
		keyword.keydown(function(e){
			if(e.keyCode==13){
				me.search();
			}
		});
		this.inputKeyword.appendTo(root);
		this.searchImg = $("<img id='searchimg' alt='点击进行搜索' src='image/08.png'></img>");
		this.searchImg.appendTo(root);
		this.searchImg.click(function(){
			me.search();
		});
	},
	
	search:function(){
		var me = this;
		var keyword = this.inputKeyword.val();
		this.localSearch.search(keyword);
		setTimeout(function(){
			me.gSearch.search(keyword);
		},3000);
	}
};